/* GUI CONVERTED from rewcrp31.p (converter v1.75) Thu Oct  5 12:01:09 2000 */
/* rewcrp31.p - WORK CENTER EFFICIENCY REPORT REPETITIVE                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/*F0PN*/ /*V8:ConvertMode=FullGUIReport                                     */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*              */
/* REVISION: 7.3      LAST MODIFIED: 01/05/95   BY: cpp *FT95*              */
/* REVISION: 7.3      LAST MODIFIED: 03/01/95   BY: WUG *G0G3*              */
/* REVISION: 8.6      LAST MODIFIED: 10/11/97   BY: bvm *K0T4*              */
/* REVISION: 8.6      LAST MODIFIED: 11/18/97   BY: bvm *K19V*              */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* REVISION: 9.1      LAST MODIFIED: 09/11/00   BY: *N0RQ* BalbeerS Rajput  */

/*K0T4*/ /* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K0T4*/ {mfdtitle.i "b+ "} /*GA37*/

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rewcrp31_p_1 "Efficiency"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp31_p_5 "Include Nonmilestone Operations"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp31_p_6 "Variance"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp31_p_9 "Setup Eff"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp31_p_10 "Qty Processed"
/* MaxLen: Comment: */

/*N0RQ*
 * &SCOPED-DEFINE rewcrp31_p_2 " Machine Total: "
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp31_p_3 "  Report Total: "
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp31_p_4 "Machine:"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp31_p_7 "Work Ctr:"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp31_p_8 "Work Ctr Total: "
 * /* MaxLen: Comment: */
 *N0RQ*/

/* ********** End Translatable Strings Definitions ********* */

define variable emp like op_emp.
define variable emp1 like op_emp.
define variable wkctr like op_wkctr.
define variable wkctr1 like op_wkctr.
define variable mch like op_mch.
define variable mch1 like op_mch.
define variable part like op_part.
define variable part1 like op_part.
define variable opdate like op_date.
define variable opdate1 like op_date.
define variable run_var like op_act_run column-label {&rewcrp31_p_6}.
define variable run_eff as decimal format "->>>9.99%" column-label {&rewcrp31_p_1}.
define variable setup_var like wr_setup format "->>9.999".
define variable setup_eff as decimal format "->>>9.99%"
column-label {&rewcrp31_p_9}.
define variable desc1 like pt_desc1.
define variable std_run like op_std_run format "->,>>9.999".
define variable setup_per like wr_setup.
define variable s_num as character extent 7 format "x(9)".
define variable d_num as decimal decimals 9 extent 7.
define variable i as integer.
define variable j as integer.
define variable multiple like mfc_logical.
/*G0G3 ADD THE FOLLOWING VARIABLE AND ITS ASSOCIATED HANDLING*/
/*K0T4*
 *def var include_nonmilestone like mfc_logical
 * label "Include Nonmilestone Operations".  **K0T4**/
/*K0T4*/ define variable include_nonmilestone like mfc_logical
         label {&rewcrp31_p_5}.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
wkctr    colon 20    wkctr1  label {t001.i} colon 49
   mch      colon 20    mch1    label {t001.i} colon 49
   opdate   colon 20    opdate1 label {t001.i} colon 49
   part     colon 20    part1   label {t001.i} colon 49
   skip(1)
   include_nonmilestone colon 35
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/*K0T4*/ {wbrp01.i}


/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if wkctr1 = hi_char then wkctr1 = "".
   if mch1 = hi_char then mch1 = "".
   if part1 = hi_char then part1 = "".
   if opdate = low_date then opdate  = ?.
   if opdate1 = hi_date then opdate1 = ?.

/*K0T4*/ if c-application-mode <> 'web' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K0T4*/ {wbrp06.i &command = update &fields = "  wkctr wkctr1 mch mch1 opdate
   opdate1 part part1 include_nonmilestone" &frm = "a"}

/*K0T4*/ if (c-application-mode <> 'web') or
/*K0T4*/ (c-application-mode = 'web' and
/*K0T4*/ (c-web-request begins 'data')) then do:

   bcdparm = "".
   {mfquoter.i wkctr  }
   {mfquoter.i wkctr1 }
   {mfquoter.i mch    }
   {mfquoter.i mch1   }
   {mfquoter.i opdate }
   {mfquoter.i opdate1}
   {mfquoter.i part   }
   {mfquoter.i part1  }
   {mfquoter.i include_nonmilestone}

   if wkctr1 = "" then wkctr1 = hi_char.
   if mch1 = "" then mch1 = hi_char.
   if part1 = "" then part1 = hi_char.
   if opdate = ?  then opdate  = low_date.
   if opdate1 = ? then opdate1 = hi_date.

/*K0T4*/ end.

   /* SELECT PRINTER */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



   {mfphead.i}

   for each op_hist where (op_wkctr >= wkctr and op_wkctr <= wkctr1)
   and (op_mch >= mch and op_mch <= mch1)
   and (op_date >= opdate and op_date <= opdate1)
   and (op_part >= part and op_part <= part1)
   and (op_type = "LABOR" or op_type = "BACKFLSH")
   and (op_act_run <> 0 or op_qty_comp <> 0)
   and (include_nonmilestone or op_milestone)
   use-index op_date
   no-lock break by op_wkctr by op_mch by op_date
   with frame b width 132 no-attr-space:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      if op_wkctr = "" then next.

/*K19V*/ if c-application-mode <> 'web' then
            view frame phead.

      std_run = op_std_run * op_qty_comp.
      run_var = std_run - op_act_run.
      run_eff = (std_run / op_act_run) * 100.

      accumulate std_run (total by op_wkctr by op_mch).
      accumulate op_act_run (total by op_wkctr by op_mch).

      if first-of(op_mch) then do with frame b:
     if first-of (op_wkctr) then multiple = no.
     else multiple = yes.
     if page-size - line-counter < 3 then page.
/*N0RQ* display {&rewcrp31_p_7} @ op_date op_wkctr @ op_shift format "x(8)". */
/*N0RQ*/ display getTermLabel("WORK_CENTER",8) + ":" @ op_date
                 op_wkctr @ op_shift format "x(8)" WITH STREAM-IO /*GUI*/ .
/*N0RQ* if op_mch > "" then display {&rewcrp31_p_4} @ op_emp op_mch @ op_part. */
/*N0RQ*/ if op_mch > "" then display getTermLabel("MACHINE",7) + ":" @ op_emp
                             op_mch @ op_part WITH STREAM-IO /*GUI*/ .
     find wc_mstr where wc_wkctr = op_wkctr and wc_mch = op_mch
     no-lock no-error.
     if available wc_mstr then do with frame b:
        if op_mch > "" then down 1.
        display wc_desc @ op_part WITH STREAM-IO /*GUI*/ .
     end.
     down 2.
      end.

      display op_date op_shift op_emp op_part op_wo_op
      op_qty_comp column-label {&rewcrp31_p_10}
      std_run op_act_run run_var column-label {&rewcrp31_p_6}
      run_eff
/*K0T4*  when run_eff <> ? */
/*K0T4*/  when (run_eff <> ?)
/*FT95*  space(3) op_trnbr. */
/*FT95*/ space(3) op_trnbr format ">>>>>>>9" WITH STREAM-IO /*GUI*/ .

      if last-of(op_mch)
      and (not last-of(op_wkctr) or multiple = yes)
      then do with frame b:

     if page-size - line-counter < 2 then page.
     else do:
       down 1.
       underline std_run op_act_run run_var column-label {&rewcrp31_p_6} run_eff.
     end.

     down 1.

/*N0RQ* display {&rewcrp31_p_2} @ op_qty_comp*/
/*N0RQ*/ display getTermLabelRt("MACHINE_TOTAL",13) + ": " @ op_qty_comp
     accum total by op_mch std_run @ std_run
     accum total by op_mch op_act_run @ op_act_run
     (accum total by op_mch std_run) - (accum total by op_mch op_act_run)
     @ run_var column-label {&rewcrp31_p_6}
     ((accum total by op_mch std_run)
     /  (accum total by op_mch op_act_run)) * 100 @ run_eff WITH STREAM-IO /*GUI*/ .

      end.

      if last-of(op_wkctr) then do with frame b:

     if page-size - line-counter < 2 then page.
     else do:
       down 1.
       underline std_run op_act_run run_var column-label {&rewcrp31_p_6} run_eff.
     end.

     down 1.

/*N0RQ* display {&rewcrp31_p_8} @ op_qty_comp*/
/*N0RQ*/ display getTermLabel("WORK_CENTER_TOTAL",14) + ": " @ op_qty_comp
     accum total by op_wkctr std_run @ std_run
     accum total by op_wkctr op_act_run @ op_act_run
     (accum total by op_wkctr std_run) -
     (accum total by op_wkctr op_act_run)
     @ run_var column-label {&rewcrp31_p_6}
     ((accum total by op_wkctr std_run)
     /  (accum total by op_wkctr op_act_run)) * 100 @ run_eff WITH STREAM-IO /*GUI*/ .

      end.

      if last (op_wkctr) then do with frame b:

     if page-size - line-counter < 2 then do with frame b:
        page.
        down 1.
     end.
     else down 2.

/*N0RQ* display {&rewcrp31_p_3} @ op_qty_comp*/
/*N0RQ*/ display getTermLabelRt("REPORT_TOTAL",14) + ": " @ op_qty_comp
     accum total std_run @ std_run
     accum total op_act_run @ op_act_run
     (accum total std_run) - (accum total op_act_run)
     @ run_var column-label {&rewcrp31_p_6}
     ((accum total std_run) /  (accum total op_act_run)) * 100 @ run_eff WITH STREAM-IO /*GUI*/ .

      end.

      
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/

   end.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.

/*K0T4*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" wkctr wkctr1 mch mch1 opdate opdate1 part part1 include_nonmilestone "} /*Drive the Report*/
